home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
doom
/
cddk9605.zip
/
HEADERS.ARJ
/
FOSSIL.INT
< prev
next >
Wrap
Text File
|
1996-05-17
|
11KB
|
245 lines
{ ───────────────────────────────────────────────────────────────────────── }
{ Name : FOSSIL.PAS }
{ Description : FOSSIL [Fido/Opus/Seadog Standard Interface Layer] support }
{ ───────────────────────────────────────────────────────────────────────── }
UNIT FOSSIL;
{$B-} { . . . . . . . . . . . . . . . . . . . . Shortcut boolean evaluation }
{$F+} { . . . . . . . . . . . . . . . . . . . . Force far calls for safety }
{$I-} { . . . . . . . . . . . . . . . . . . . Disable input/output checking }
{$O+} { . . . . . . . . . . . . . . . . . . Allow this unit to be overlayed }
{$Q-} { . . . . . . . . . . . . . . Do not generate overflow-checking code }
{$R-} { . . . . . . . . . . . . . . . . Do not generate range-checking code }
{$S-} { . . . . . . . . . . . . . . . . Do not generate stack-checking code }
{$X+} { . . . . . . . . . . . Extended syntax for pChars and function calls }
INTERFACE
CONST
{ Baud rates }
_300 = $00 + $40 + $00; { 010----- }
_600 = $00 + $40 + $20; { 011----- }
_1200 = $80 + $00 + $00; { 100----- }
_2400 = $80 + $00 + $20; { 101----- }
_4800 = $80 + $40 + $00; { 110----- }
_9600 = $80 + $40 + $20; { 111----- }
_19200 = $00 + $00 + $00; { 000----- }
_38400 = $00 + $00 + $20; { 001----- }
{ Communications ports }
_COM1 = $00;
_COM2 = $01;
_COM3 = $02;
_COM4 = $03;
{ FOSSIL status constants }
RDA = $01; { AH 00000001 }
OVRN = $02; { AH 00000010 }
THRE = $20; { AH 00100000 }
TSRE = $40; { AH 01000000 }
DCD = $80; { AL 10000000 }
{ Flow control constants }
XON_XOFF_Transmit = 1;
RTS_CTS = 2;
DSR_DTR = 4;
XON_XOFF_Receive = 8;
TYPE
FOSSIL_Info_Type = RECORD
Size : Word; { Size of structure in bytes }
Spec : Byte; { Conforms to this specification }
Version : Byte; { Version of this driver }
ASCII_ID : Pointer; { Far pointer to ASCII ID string }
IBSize : Word; { Size of inbound buffer }
IBFree : Word; { No. of bytes left in inbound buffer }
OBSize : Word; { Size of outbound buffer }
OBFree : Word; { No. of bytes left in outbound buffer }
Width : Byte; { Width of screen on adapter }
Height : Byte; { Height of screen on adapter }
Baud : Byte; { Baud code, per function 03h (see below) }
END;
{ The ASCII_ID string is null-terminated and will not contain a }
{ newline character. The baud field uses the same format used }
{ by function 03h. Port-specific fields are undefined if the }
{ port is FFh or invalid. }
FUNCTION MakeBaudCode(Baud:LongInt):Byte;
{ Constructs a FOSSIL baud-rate code using 8N1 settings. }
PROCEDURE FOSSIL_Set_Baud(FOSSIL_Port:Word; Code:Byte);
{ Sets the baud rate for the specified port. The code is a mask: }
{ }
{ 000 00 0 00 }
{ │ │ │ └─ Character length; 00=5, 01=6, 10=7, 11=8 }
{ │ │ └──── Stop bits; 0=1, 1=1.5 for 5-bit char or 2 for others }
{ │ └────── Parity; 00=None, 10=None, 01=Odd, 11=Even }
{ └───────── Baud rate: 010 = 300 011 = 600 }
{ 100 = 1200 101 = 2400 }
{ 110 = 4800 111 = 9600 }
{ 000 = 19200 001 = 38400 }
PROCEDURE FOSSIL_Xmit_Chr(FOSSIL_Port:Word; C:Char);
{ Transmits the character. Control will not be returned until there }
{ is room in the outbound buffer. }
PROCEDURE FOSSIL_Read_Chr(FOSSIL_Port:Word; VAR C:Char);
{ Reads a character from the inbound buffer. The FOSSIL driver will }
{ wait until a character is available. }
FUNCTION FOSSIL_Carrier_Detect(FOSSIL_Port:Word):Boolean;
{ Returns TRUE if a user is online, FALSE if not. }
FUNCTION FOSSIL_Char_Waiting(FOSSIL_Port:Word):Boolean;
{ Returns TRUE if a character is waiting in the inbound buffer. }
FUNCTION FOSSIL_Init(FOSSIL_Port:Word):Boolean;
{ Initializes the FOSSIL driver. This function should be called before }
{ any communications routines are used. Returns TRUE if a FOSSIL }
{ driver is installed, FALSE if not. }
PROCEDURE FOSSIL_DeInit(FOSSIL_Port:Word);
{ Deinitializes the FOSSIL driver. You should call this procedure }
{ when exiting your program. DTR is not affected. }
PROCEDURE FOSSIL_Lower_DTR(FOSSIL_Port:Word);
PROCEDURE FOSSIL_Raise_DTR(FOSSIL_Port:Word);
{ These two procedures control the DTR line to the modem. Lowering }
{ DTR will usually terminate the connection (but not always). }
FUNCTION FOSSIL_Timer_Int:Byte;
FUNCTION FOSSIL_Ticks_Per_Second:Byte;
FUNCTION FOSSIL_MS_Per_Tick:Word;
{ These three functions can be used for critical timing or to set }
{ up code that is executed every certain number of clock ticks. }
{ FOSSIL_Timer_Int returns the interrupt number of the timer. }
{ FOSSIL_Ticks_Per_Second returns the number of ticks per second }
{ of the interrupt. FOSSIL_MS_Per_Tick returns the approximate }
{ number of milliseconds per pick. }
PROCEDURE FOSSIL_Flush_Output(FOSSIL_Port:Word);
{ Sends any data waiting in the outbound buffer. Control will not }
{ be returned until all of the data has been sent. }
PROCEDURE FOSSIL_Purge_Output(FOSSIL_Port:Word);
PROCEDURE FOSSIL_Purge_Input(FOSSIL_Port:Word);
{ These two procedures are used to discard the data in the outbound }
{ and inbound buffers, respectively. }
FUNCTION FOSSIL_Xmit_Chr_No_Wait(FOSSIL_Port:Word; C:Char):Boolean;
{ Attempts to transmit the specified character. Returns TRUE if }
{ room was available in the outbound buffer, FALSE if not. }
FUNCTION FOSSIL_Peek(FOSSIL_Port:Word):Char;
{ Returns the next character in the inbound buffer without removing }
{ that character from the buffer. FFh (#255) is returned if no }
{ characters are waiting. If your software is not prepared to check }
{ for FFh, you should use FOSSIL_Char_Waiting in combination with }
{ FOSSIL_Read_Chr. }
PROCEDURE FOSSIL_Read_Key_No_Wait(VAR C:Char);
PROCEDURE FOSSIL_Read_Key(VAR C:Char);
{ These two procedures provide access to the IBM keyboard. }
{ FOSSIL_Read_Key waits until a key is available in the keyboard buffer. }
{ FOSSIL_Read_Key_No_Wait returns immediately with FFh (#255) if }
{ a key has not been pressed. }
PROCEDURE FOSSIL_Flow_Control(FOSSIL_Port:Word; Mask:Byte);
{ Enables and disables flow control. }
{ }
{ xxxx 0000 }
{ │ │││└─ XON/XOFF flow control on transmit }
{ │ ││└── RTS/CTS flow control }
{ │ │└─── Reserved for DSR/DTR }
{ │ └──── XON/XOFF flow control on receive }
{ │